﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using K2CoreLib.DataObject;
using System.Data;
using K2CoreLib.Shared;

namespace K2CoreLib.Dao.Hcs
{
    class EmpDataDao
    {
        // Get Employee basic information 
        public EmpManagerDto GetEmpData(string EmpIdOrAccount)
        {
            string storeName = @"K2_spGetManager";
            object[] parms = { "@EmpIdOrAccount", EmpIdOrAccount };

            return HcsDb.ReadFromStore(storeName, Make, parms);
        }

        // Make data transfer object
        private Func<IDataReader, EmpManagerDto> Make = reader =>
            new EmpManagerDto
            {
                EmpID = reader["EmpID"].AsString(),
                EmpCode = reader["EmpCode"].AsString(),
                DomainAccount = reader["DomainAccount"].AsString(),
                ReportingLine = reader["ReportingLine"].AsString(),
                TeamLead = reader["TeamLead"].AsString(),
                TeamOrgID = reader["TeamOrgID"].AsString(),
                TeamOrgCode = reader["TeamOrgCode"].AsString(),
                DeptHead = reader["DeptHead"].AsString(),
                DeptOrgID = reader["DeptOrgID"].AsString(),
                DeptOrgCode = reader["DeptOrgCode"].AsString(),
                DivHead = reader["DivHead"].AsString(),
                DivOrgID = reader["DivOrgID"].AsString(),
                DivOrgCode = reader["DivOrgCode"].AsString(),
                HrbpAssitant = reader["HrbpAssitant"].AsString(),
                HrbpLeader = reader["HrbpLeader"].AsString(),
                ExtNo = reader["ExtNo"].AsString(),
                Email = reader["Email"].AsString(),
                Active = reader["Active"].AsString()
            };

    }
}
